﻿package mortal.game.view.flowerSend.effect
{
    import Message.Public.*;
    import __AS3__.vec.*;
    import com.gengine.utils.pools.*;
    import mortal.game.cache.*;
    import mortal.game.view.systemSetting.*;

    public class FlowerEffectUtil extends Object
    {
        private static var _msgVec:Vector.<SFlowerNoticeMsg>;
        private static var _isInEffect:Boolean = false;

        public function FlowerEffectUtil()
        {
            return;
        }// end function

        public static function playEffect(param1:SFlowerNoticeMsg) : void
        {
            if (!_msgVec)
            {
                _msgVec = new Vector.<SFlowerNoticeMsg>;
            }
            if (SystemSetting.instance.isHideAllEffect.bValue || SystemSetting.instance.isHideFlowerEffect.bValue)
            {
                return;
            }
            _msgVec.push(param1);
            if (!_isInEffect)
            {
                playNext();
                _isInEffect = true;
            }
            return;
        }// end function

        public static function playNext() : void
        {
            var _loc_1:SFlowerNoticeMsg = null;
            var _loc_2:String = null;
            var _loc_3:FlowerEffectImpl = null;
            if (_msgVec.length)
            {
                if (SystemSetting.instance.isHideAllEffect.bValue || SystemSetting.instance.isHideFlowerEffect.bValue)
                {
                    _msgVec.length = 0;
                    return;
                }
                _loc_1 = _msgVec.shift();
                _loc_2 = Cache.instance.role.entityInfo.name;
                if (_loc_2 != _loc_1.fromPlayer && _loc_2 != _loc_1.toPlayer)
                {
                    _loc_3 = ObjectPool.getObject(FlowerEffectImpl) as FlowerEffectImpl;
                    _loc_3.wave(_loc_1, playNext);
                }
            }
            else
            {
                _isInEffect = false;
            }
            return;
        }// end function

    }
}
